﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using rock.DAL;
using rock.Model;

namespace rock.UI.custom
{
    public partial class UserControlImportCustomInfo : UserControl
    {
       

        public UserControlImportCustomInfo()
        {
            InitializeComponent();
 
        }
        DalRENT_CUSTOM dal = new DalRENT_CUSTOM();
          
        private bool SHOW_BUTTON = false;
        public bool _SHOW_BUTTON { get { return SHOW_BUTTON; } set {
            SHOW_BUTTON = value;
            this.button1.Enabled = SHOW_BUTTON;
        } }

        
       
        private int CUSTOM_SEQID = 0;
        public int _CUSTOM_SEQID { get { return CUSTOM_SEQID; } set { CUSTOM_SEQID = value; } }

        public void inits( int CUSTOM_SEQID)
        {
            _CUSTOM_SEQID = CUSTOM_SEQID;
            ModelRENT_CUSTOM model = dal.GetModel(CUSTOM_SEQID);
            this.textBox1Card.Text = model.CARDID;
            this.textBox1Name.Text = model.NAME;
            this.textBox2Add.Text = model.ADDRESS;
            this.textBox3Phone.Text = model.PHONE;
            this.textBox4Type.Text = model.TYPE == 0 ? "个人" : "商户";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FormSelectCustom fsc = new FormSelectCustom();
            fsc.selectedOk = SelectedOk;
            fsc.ShowDialog(this);

        }
        // public delegate void SelectedOk(int CONTRACT_SEQID , int ROOM_SEQID , int CUSTOM_SEQID);
        public void SelectedOk(int seqid, int type)
        {
            inits(seqid);
        }

         
    }
}
